feat(ai): refresh provider model catalogs on demand - #938
Conversation
📓 Changelog previewThis is what your commits will add to the generated ## [Unreleased]
### Added
- **ai:** Refresh provider model catalogs on demand |
Greptile SummaryThe PR replaces static provider catalogs with permission-checked, account-aware refresh flows backed by persistent user workspaces.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| crates/temps-ai-agent-cli/src/service.rs | Implements principal-scoped workspace model snapshots, refresh coordination, cache invalidation, and workspace-backed discovery. |
| crates/temps-agents/src/ai_cli/claude.rs | Replaces synthesized Claude identifiers with parsing of the authenticated CLI initialization response. |
| crates/temps-agents/src/handlers/ai_providers.rs | Adds permission-checked provider catalog refresh handling and sanitized failures. |
| crates/temps-sandbox/src/services/sandbox_service.rs | Extends persistent workspace lifecycle handling used by model discovery and recovery. |
| web/src/pages/agent-sandbox/AgentSandboxProviderDetail.tsx | Uses a React Query mutation for provider model refresh and renders mutation-owned pending state. |
| web/src/lib/ai-provider-catalog-query.ts | Centralizes provider catalog query configuration and cache updates for refreshed catalogs. |
Sequence Diagram
sequenceDiagram
participant UI as Provider UI
participant API as Refresh API
participant Cache as Principal Catalog Cache
participant WS as User Workspace
participant CLI as Provider CLI
UI->>API: Refresh provider models
API->>Cache: Check principal-scoped refresh state
API->>WS: Create or wake persistent workspace
WS->>CLI: Run authenticated capability discovery
CLI-->>WS: Account-aware model catalog
WS-->>API: Sanitized discovery result
API->>Cache: Store principal-scoped catalog
API-->>UI: Refreshed models or actionable Problem
Reviews (7): Last reviewed commit: "feat(ai): refresh provider model catalog..." | Re-trigger Greptile
1efcc7a to
684f849
Compare
|
@greptile-apps please re-review the current head. All previous findings have been addressed with regression coverage. |
52292c4 to
937ad03
Compare
|
@greptile-apps please re-review the current head. The model refresh now creates/wakes the principal-owned persistent global workspace, uses the provider-native Claude initialize catalog, and fail-closes recovered workspace reuse behind a verified process-tree fence. All prior backend, frontend, lifecycle, and security findings have been addressed. |
937ad03 to
11c19bd
Compare
|
@greptile-apps please re-review current head 11c19bd. The only delta after your prior 5/5 is a target-specific cfg on the macOS-only Duration import, fixing the Linux all-features Clippy job. |
Discover provider capabilities explicitly instead of spawning CLIs during catalog reads. Cache authoritative results, preserve stale selections safely, and refresh workspace-capable providers through isolated credential relays. Signed-off-by: David Viejo <dviejo@kfs.es>
11c19bd to
0caa26e
Compare
|
@greptile-apps please re-review current head 0caa26e. Workspace model discovery now performs one controlled automatic wake per explicit application selection, persists and renders safe actionable startup diagnostics, sanitizes every provider/snapshot lifecycle Problem, and has unit, full-suite, live Docker-failure browser, and security-review coverage. |
Summary
temps-agent-runtimeWhy
Provider model lists are account-aware and can change independently of Temps. Claude Code exposes the usable catalog only after its authenticated CLI initializes, so a static host-side list cannot be authoritative. Previously, Temps advertised invented identifiers such as
claude-sonnet-5; those values could be rejected by the installed harness.The refresh flow now asks the real CLI in the user's workspace. For a global user-owned chat, Temps creates or wakes that user's persistent workspace automatically. It does not require the user to manually start a sandbox, and it does not treat an unavailable sandbox as a successful empty workspace.
Behavior
global-user-{principal}through the normal workspace and sandbox servicesSandboxService, preserving its volume and synchronizing registry/database stateEvidence
Backend
The real process regression also verified that a TERM-resistant parent and child are escalated and removed:
cargo test --lib -p temps-agents strict_fence_kills -- --nocaptureFrontend
bun test src/components/ai/DebugChatPanel.test.ts src/components/ai/chat-runtime-options.test.ts bunx tsc --noEmitBrowser
agent-browserexercised the generated client against the exact branch server in isolated dev slot 33:Sandbox starting/recoveringRepository gates
Security
SandboxesWriteandSandboxesExecReview